home *** CD-ROM | disk | FTP | other *** search
/ PC Open 100 / PC Open 100 CD 1.bin / CD1 / INTERNET / WEBDESIGN / Tsw WebCoder / tswwebcoder5en.exe / {app} / data / tools / dialog_textarea.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-02  |  5.7 KB  |  112 lines

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <dialog width="425" height="310" caption="Textarea field">
  3.     <controls>
  4.         <panel name="mainpanel" caption="" align="alclient" bevelinner="bvnone" bevelouter="bvnone">
  5.             <label name="lblName" caption="Name" hint="The name of this element. Important if you wish to refer to this form element through some sort of scripting for instance. This field is required." width="26" height="13" top="8" left="8"/>
  6.             <label name="lblValue" caption="Text/value" hint="Text/value of your form element." width="59" height="13" top="8" left="192"/>
  7.             <label name="lblWidth" caption="Width" hint="Choose the width of your textarea field." width="34" height="13" top="56" left="96"/>
  8.             <label name="lblRows" caption="Lines" hint="Number of lines visible at the same time." width="25" height="13" top="56" left="8"/>
  9.             <edit name="edtName" taborder="0" text="" hint="The name of this element. Important if you wish to refer to this form element through some sort of scripting for instance. This field is required." width="169" height="19" top="24" left="8"/>
  10.             <memo name="mmoText" taborder="1" hint="If you want predefined text in your textarea, you can enter it here." width="217" height="97" top="24" left="192"/>
  11.             <spinedit name="speRows" taborder="2" hint="Number of lines visible at the same time." maxvalue="0" minvalue="0" value="0" width="81" height="20" top="72" left="8"/>
  12.             <spinedit name="speCols" taborder="3" hint="Choose the width of your textarea field." maxvalue="0" minvalue="0" value="0" width="81" height="20" top="72" left="96"/>
  13.             <checkbox name="cbReadonly" caption="Readonly" taborder="4" hint="If your element is readonly, the user will not be able to make any changes to it." checked="0" width="73" height="17" top="104" left="8"/>
  14.             <checkbox name="cbDisabled" caption="Disabled" taborder="5" hint="Your element will be visible, but disabled." checked="0" width="89" height="17" top="104" left="96"/>
  15.         </panel>
  16.     </controls>
  17.     <dialogevents>
  18.         <event type="onclose" resulttype="ok">
  19.             StartCode := ('<textarea');
  20.             if speCols.Value > 0 then
  21.              StartCode := StartCode+' cols="'+(IntToStr(speCols.Value))+'"';
  22.             if speRows.Value > 0 then
  23.              StartCode := StartCode + ' rows="'+(intToStr(speRows.Value))+'"';
  24.             if edtName.Text > '' then
  25.              StartCode := StartCode + (' name="'+(edtName.Text)+'"');
  26.             if cbReadonly.Checked then
  27.              StartCode := StartCode + (' readonly');
  28.             if cbDisabled.Checked then
  29.              StartCode := StartCode + (' disabled');
  30.  
  31.               If edtCSSClass.Text <> '' then
  32.              StartCode := StartCode + ' class="'+edtCSSClass.Text+'"';
  33.               If edtCSSId.Text <> '' then
  34.                StartCode := StartCode + ' ID="'+edtCSSId.Text+'"';
  35.               If edtCSSStyle.Text <> '' then
  36.                StartCode := StartCode + ' style="'+edtCSSStyle.Text+'"';
  37.             for i := 0 to EventGrid.Count - 1 do
  38.               begin
  39.               if EventGrid.Rows[i].EditText <> '' then
  40.                StartCode := StartCode + ' ' + (EventGrid.Rows[i].Caption+'="' + EventGrid.Rows[i].EditText)+'"';
  41.              end;    
  42.  
  43.             StartCode := StartCode + '>';
  44.             
  45.             EndCode := mmoText.Text+'</textarea>';
  46.             
  47.             
  48.             If cbMakeXHTMLCompliant.Checked then
  49.              StartCode := MakeXHTMLCompliant(StartCode, true);
  50.             If cbDoPHPEscape.Checked then
  51.              StartCode := DoPHPEscape(StartCode);         
  52.             // A little "hack" - WebCoder will set this, to let us know whether to update
  53.             // an existing tag, or insert a brand new one
  54.             If cbUpdateExistingTag.Checked then 
  55.              ReplaceTag(StartCode+EndCode)
  56.             else
  57.              If mmoText.Text <> '' then
  58.               begin
  59.                If Editor.SelText <> '' then
  60.                 Editor.SelText := StartCode+EndCode
  61.                else 
  62.                    InsertTags(StartCode+EndCode, '')
  63.                  end 
  64.                 else
  65.               InsertTags(StartCode, EndCode);
  66.               
  67.         </event>
  68.         <event type="onshow">    
  69.             If (Editor.SelText <> '') AND (cbUpdateExistingTag.Checked = false) then
  70.              mmoText.Text := Editor.SelText;            
  71.             // Lets put the advanced panel in the right place
  72.             pnlAdvanced.Parent := MainPanel;
  73.             pnlAdvanced.Left := 8;
  74.             pnlAdvanced.Top := MainPanel.Height - 32;        
  75.             pnlAdvanced.Width := Self.Width - 36;
  76.             // Height of the panel will be set internally. Do we need to make the dialog higher to make room for the Advanced panel?
  77.             If pnlAdvanced.Height > 20 then
  78.              Self.Height := Self.Height + 200;
  79.         </event>
  80.         <event type="updatedialog">
  81.             // This event will be called when a user executes the "Edit current tag"-rightclick feature
  82.             // The entire selected tag will be passed as a parameter to this function, that should update
  83.             // the required fields of the dialog.
  84.             function UpdateDialog(Tag: string);
  85.              begin
  86.               Cols := GetValueFromAttribute(Tag, 'cols');
  87.               If Cols <> '' then
  88.                speCols.Value := StrToInt(Cols);
  89.               Rows := GetValueFromAttribute(Tag, 'rows');
  90.               If Rows <> '' then
  91.                speRows.Value := StrToInt(Rows);
  92.               edtName.Text := GetValueFromAttribute(Tag, 'name');
  93.               cbReadonly.Checked := HasOption(Tag, 'readonly');
  94.               cbDisabled.Checked := HasOption(Tag, 'disabled');
  95.               mmoText.Text := GetValueFromTag(Tag);
  96.               
  97.                 edtCSSClass.Text := GetValueFromAttribute(Tag, 'class');
  98.                 edtCSSId.Text := GetValueFromAttribute(Tag, 'id');
  99.                 edtCSSStyle.Text := GetValueFromAttribute(Tag, 'style');
  100.               for i := 0 to EventGrid.Count - 1 do
  101.                 begin
  102.                  EventVal := GetValueFromAttribute(Tag, Lowercase(EventGrid.Rows[i].Caption));
  103.                  If EventVal <> '' then
  104.                   EventGrid.Rows[i].EditText := EventVal;
  105.                end;  
  106.               cbDoPHPEscape.Checked := IsPHPEscaped(Tag);
  107.               cbMakeXHTMLCompliant.Checked := isXHTMLDocument();                            
  108.              end;
  109.         </event>
  110.     </dialogevents>
  111. </dialog>
  112.